package com.msb.mall.producet.controller;

import com.msb.common.utils.PageUtils;
import com.msb.common.utils.R;
import com.msb.mall.producet.entity.CategoryEntity;
import com.msb.mall.producet.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Auther: mfy
 * @Data: 2022 - 05 - 26 - 14:04
 * @Description: com.msb.mall.producet.controller
 * @Version: 1.0
 */
@RestController
@RequestMapping(path = "product/category")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {

        PageUtils page = categoryService.queryPage(params);
        return R.ok().put("page",page);
    }

    @RequestMapping("/listPageWithAll")
    public R listPageWithAll(@RequestParam Map<String, Object> params) {

        List<CategoryEntity> list = categoryService.queryPageWithAll(params);
        return R.ok().put("data",list);
    }

}
